package com.example.contentprovider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import androidx.annotation.Nullable;

public class MyDBhelper extends SQLiteOpenHelper {      //名字            nullable允许为null 游标工厂
    public MyDBhelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        Log.d("wyw","MyDBhelper is run....");
    }
    //未定义数据库访问规则 所以onCreate无法启用
    @Override  //建表
    public void onCreate(SQLiteDatabase sqLiteDatabse) {
        //建table表
        sqLiteDatabse.execSQL("create table student(id integer primary key autoincrement,name varchar,age integer)");
        Log.d("wyw","oncreate is run....");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
